#include "stdio.h"

#include "rq.h"

#include "event_manager.h"



obj_event_manager_t em;


void cstl_ring_queue_example(void)
{

    printf("hello c state machine\n");

    uint8_t* u8_data;
    ring_queue_t* u8_rq;
    uint8_t index;
    rq_create_T(uint8_t,u8_rq,u8_data,3);

    if(u8_rq)
    printf("rq created!\n");

    if(u8_data)
    printf("data created!\n");

    printf("rq len:%d\n",rq_len(u8_rq));

    rq_enqueue_T(u8_rq,u8_data,1);
    printf("rq len:%d\n",rq_len(u8_rq));

    rq_enqueue_T(u8_rq,u8_data,2);
    printf("rq len:%d\n",rq_len(u8_rq));

    rq_enqueue_T(u8_rq,u8_data,3);
    printf("rq len:%d\n",rq_len(u8_rq)); 

    rq_enqueue_T(u8_rq,u8_data,4);
    printf("rq len:%d\n",rq_len(u8_rq)); 

    rq_dequeue_T(u8_rq);
    printf("rq len:%d\n",rq_len(u8_rq));

    rq_enqueue_T(u8_rq,u8_data,5);
    printf("rq len:%d\n",rq_len(u8_rq)); 

    rq_forech(u8_rq,index)
    {
       printf("u8_rq[%d] = %d\n",index,u8_data[index]);
    }    

    printf("bye c state machine\n");
}

void main (void)
{

//    cstl_ring_queue_example(); 
printf("start\n");
em_init(&em);
printf("init\n");
em_event_loop_start(&em);
printf("exit\n");

}